// 首页路由
export const homeRouter = {
  path: '/',
  name: 'home',
  meta: { title: '首页', icon: 'HomeFilled' },
  component: () => import('../views/home/index.vue')
}

// 错误页面路由
export const errorRouter = [
  {
    path: '/403',
    name: '403',
    component: () => import('@/components/ErrorMessage/403.vue'),
    meta: {
      title: '403页面',
      hide: true
    }
  },
  {
    path: '/404',
    name: '404',
    component: () => import('@/components/ErrorMessage/404.vue'),
    meta: {
      title: '404页面',
      hide: true
    }
  },
  {
    path: '/500',
    name: '500',
    component: () => import('@/components/ErrorMessage/500.vue'),
    meta: {
      title: '500页面',
      hide: true
    }
  },
  {
    path: '/:pathMatch(.*)*',
    component: () => import('@/components/ErrorMessage/404.vue'),
    meta: {
      title: '404页面',
      hide: true
    }
  }
]

// 静态路由
const staticRouter = [
  homeRouter,
  {
    path: '/login',
    name: 'login',
    meta: { title: '登录', hide: true },
    component: () => import('../views/login/index.vue')
  },
  ...errorRouter
]

// 动态路由
const dynamicRouter = [
  {
    path: '/customer',
    name: 'customer',
    meta: { title: '客户管理', icon: 'UserFilled' },
    component: () => import('../views/customer/list/index.vue')
    // redirect: '/customer/list',
    // children: [
    //   {
    //     path: '/customer/list',
    //     name: 'customerList',
    //     meta: { title: '客户列表', icon: 'UserFilled' },
    //     component: () => import('../views/customer/list/index.vue')
    //   },
    //   {
    //     path: '/customer/add',
    //     name: 'customerAdd',
    //     meta: { title: '新建客户', icon: 'UserFilled' },
    //     component: () => import('../views/customer/add/index.vue')
    //   }
    // ]
  },
  {
    path: '/plateform',
    name: 'plateform',
    meta: { title: '平台管理员', icon: 'Avatar' },
    component: () => import('../views/plateform/list/index.vue')
  }
]

const routes: any = [...staticRouter, ...dynamicRouter]

export default routes
